<script type="text/javascript" src="<?php echo Yii::app()->request->baseUrl; ?>/js/pages/AdminBlogArticle_list.js"></script>

<?php include $this->getLayoutFile('block_top_messages'); ?>
<form id="searchForm" class="searchForm1" method="post" action="">

    <fieldset>
        <legend>搜尋</legend>

        <div class="field">
            <label for="搜尋關鍵字">搜尋關鍵字</label>
            <div class="show">
                <input type="text" name="searchKey" value="<?php echo $searchKey; ?>" size="30" />
            </div>
            <div class="info"></div>
        </div>

        <div class="field">
            <label for="show">&nbsp;</label>
            <div class="show">
                <input class="submit" type="submit" value="顯示" />
            </div>
            <div class="info"></div>
        </div>

    </fieldset>

</form>
<br style="clear:both" />

<div class="block">
    <a href="#" situs="<?php echo $this->url->get('adminBlogArticle','new'); ?>" class="button1 openWorkWin">建立</a>
</div>


<form id="listForm" method="post" action="<?php echo $this->createUrl('adminBlogArticle/delete'); ?>">

    <table class="table1" cellspacing="0">
        <tr>
            <th class="nobg">
                <input class="checkbox" type="checkbox" id="chooseItemsAll" value="1" />
            </th>
            <th> 標題                   </th>
            <th> 狀態                   </th>
            <th> 建立日期               </th>
            <th> 最後修改日期           </th>
            <th> 管理                   </th>
        </tr>
        <?php
            foreach( $blogArticles as $blogArticle ) {
                $blog = $blogArticle->getBlog();
                $articleText = $blogArticle->getArticleText();
                echo '<tr>';
                echo '    <th><input class="checkbox" type="checkbox" name="chooseItems[]" value="'. $blogArticle->getId() .'"></th>';
                echo     '<td>'. $articleText->getTopic()                .'</td>';
                echo     '<td>'. $blogArticle->trByStatus('status', $blogArticle->getStatus() ) .'</td>';
                echo     '<td>'. $blogArticle->getCreateDateByFormat()   .'</td>';
                echo     '<td>'. $blogArticle->getUpdateDateByFormat()   .'</td>';
                echo     '<td>';
                echo         '<a href="#" class="openWorkWin" situs="'. $this->url->get('adminBlogArticle','edit',$blogArticle) .'">編輯</a> ';
              //echo         '<a href="'. $this->url->get('adminBlogArticle','edit',$blogArticle)     .'">編輯</a> ';
              //echo         '<a href="'. $this->url->get('adminBlogArticle','delete',$blogArticle)   .'">刪除</a> ';
                echo     '</td>';
                echo '</tr>';
            }
        ?>
    </table>

</form>

<?php  if( $this->pageLimit ) { echo '<div>'. $this->pageLimit->render() .'</div>'; }  ?>



<script type="text/javascript">

    app.doResultHook = function( o ) {
        //console.log(o); // debug
        o = o || {};
        if( o.nameKey=='adminBlogArticle' && o.action=='new' && o.successType==1 ) {
            //app.popupWindowLink.close();
            //document.location.reload();
            setTimeout("app.popupWindowLink.close()",500);
            setTimeout("document.location.reload()",500);
            return;
        }
        else if( o.nameKey=='adminBlogArticle' && o.action=='edit' && o.successType==1 ) {
            setTimeout("app.popupWindowLink.close()",500);
            setTimeout("document.location.reload()",500);
            return;
        }
    }

</script>
